package com.concise.appapi.controller;

import com.concise.appapi.service.ClassificationService;
import com.initialize.pub.pojo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: concise-blog
 * @description: 分类控制器
 * @author: Mr.Jane
 * @create: 2019-10-16 15:56
 **/
@Api(tags = "分类API")
@CrossOrigin
@RestController
@RequestMapping(value = "/classification")
public class ClassificationController {

    final
    ClassificationService classificationService;

    public ClassificationController(ClassificationService classificationService) {
        this.classificationService = classificationService;
    }

    @ApiOperation(value = "获取所有的分类")
    @GetMapping("/all_categories")
    public Result getAllTheCategories() {
        return classificationService.getAllTheCategories();
    }

    @ApiOperation(value = "获取分类的数量")
    @GetMapping("/number_of_categories")
    public int getTheNumberOfCategories() {
        return classificationService.getTheNumberOfCategories();
    }





}
